<template>
  <!-- 按钮封装 -->
  <div
    class="but"
    :class="{ green: type == 'green', red: type == 'red' }"
    @click="successful"
  >
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    type: {
      type: String,
    },
  },
  methods: {
    successful(e) {
      this.$emit("click", e);
    },
  },
};
</script>

<style lang="less" scoped>
.but {
  width: 318 * 100vw/360;
  height: 50px;
  border-radius: 25px;
  border: 1px solid transparent;
  line-height: 50px;
  font-size: 20px;
  text-align: center;
  background-color: #fa920a;
  color: #fff;
}
.green {
  color: #fff;
  background-color: green;
  border: 1px solid transparent;
}
.red {
  color: #fff;
  background-color: red;
  border: 1px solid transparent;
}
</style>